const {addAskDao, getAskListDao, updateAskByIdDao, getAskByIdDao} = require("../dao/askDao");

/**
 * 添加咨询
 * @param askData
 * @returns {Promise<{msg, code, data}>}
 */
const {formatResponse} = require("../utils/tool");
module.exports.addAskService = async (askData) => {
    const result = await addAskDao(askData)
    return formatResponse(0, '添加成功', result);
}
/**
 * 获取咨询列表
 * @returns {Promise<{msg, code, data}>}
 */
module.exports.getAskListService = async () => {
    const result = await getAskListDao()
    return formatResponse(0, '查询成功', result);
}
/**
 * 根据id更新咨询
 * @param askId
 * @param askData
 * @returns {Promise<{msg, code, data}>}
 */
module.exports.updateAskByIdService = async (askId, askData) => {
    const result = await updateAskByIdDao(askId, askData)
    return formatResponse(0, '更新成功', result);
}
module.exports.getAskByIdService = async (askId) => {
    const result = await getAskByIdDao(askId)
    return formatResponse(0, '查询成功', result);
}